package cn.sumpu.app.guoguojie.biz.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import cn.sumpu.app.guoguojie.biz.DoorplateBiz;
import cn.sumpu.app.guoguojie.dao.DoorplateDao;
import cn.sumpu.app.guoguojie.domain.Doorplate;
import cn.sumpu.app.guoguojie.exception.AppBusinessException;
import cn.sumpu.app.guoguojie.util.Common;

public class DoorplateBizImpl implements DoorplateBiz {

	private DoorplateDao doorplateDao;

	public void setDoorplateDao(DoorplateDao doorplateDao) {
		this.doorplateDao = doorplateDao;
	}

	@Override
	public List<Doorplate> doorplateList() throws AppBusinessException {
		Map<String, Object> map = new HashMap<String, Object>();
				map.put("pageSize", Common.PAGE_SIZE_DOORPLATE);
		List<Doorplate> doorplateList = doorplateDao.getDoorplateList(map);

		
		return doorplateList;

	}
	@Override
	
	public boolean isVipDoorplate(String value) throws AppBusinessException {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("value", value);
		Doorplate vipdoorplate = doorplateDao.getVipDoorplateList(map);
		if(vipdoorplate != null)
			return true;
		else 
			return false;
	}

	@Override
	public void updateDoorplate(String value) throws AppBusinessException {
		Doorplate doorplate = new Doorplate();
		doorplate.setValue(value);
		doorplate.setIn_use(true);
		doorplateDao.update(doorplate);
	}
	
	

}